using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace WPCoco.Tasks
{
    public class EaseElasticInFunction : EaseFunction
    {
        public EaseElasticInFunction(float period)
        {
            this.period = period;
        }

        readonly float period;

        public override float Evaluate(float time)
        {
            float result = 0;

            if (time <= 0 || time >= 1)
            {
                result = time;
            }
            else
            {
                float s = period / 4;
                time = time - 1;
                result = -(float)(Math.Pow(2, 10 * time) * Math.Sin((time - s) * MathHelper.Pi * 2.0f / period));
            }

            return result;
        }
    }
}
